package com.lry;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class GlobalSession {

    private String xid;

    private GlobalStatus globalStatus;

    //全局事务下的所有分支事务
    private List<BranchSession> branchSessionList = new ArrayList<>();

    private Tm tm;

    public GlobalSession(){}

    private GlobalSession(String xid, GlobalStatus globalStatus,Tm tm) {
        this.xid = xid;
        this.globalStatus = globalStatus;
        this.tm = tm;
    }

    public static GlobalSession createGlobalSession(String xid, GlobalStatus globalStatus,Tm tm){
        return new GlobalSession(xid,globalStatus,tm);
    }
}
